﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

using System.Collections;

namespace MHWPA
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            this.DataContext = App.Model;
            App.Model.RefreshUris();
        }

        private void MusicListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MHViewModel.CollectionItem ci = this.MusicListBox.SelectedItem as MHViewModel.CollectionItem;
            if (ci == null) return;
            App.AlbumModel.Uri = ci.Uri;
            App.AlbumModel.Image = ci.PosterImage;
            NavigationService.Navigate(new Uri("/Views/AlbumDetail.xaml", UriKind.Relative));

            ((ListBox)sender).SelectedItem = null;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Views/VideoPlayer.xaml", UriKind.Relative));
        }
    }
}